/**
 *  Copyright 2009-2010 Steven Ottenhoff (Dual-IT)
 * 
 *  This file is part of Clazzified.
 *
 *  Clazzified is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Clazzified is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Clazzified.  If not, see http://www.gnu.org/licenses/gpl.
 * 
 */
package nl.dualit.clazzified.core.model.clazz;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Observable;
import java.util.Observer;

import nl.dualit.clazzified.core.model.attribute.IAttribute;
import nl.dualit.clazzified.core.model.manipulation.IManipulation;
import nl.dualit.clazzified.core.model.object.IObjekt;
import nl.dualit.clazzified.core.model.relation.IRelation;
import nl.dualit.clazzified.store.clazz.ClazzFields;

import org.apache.log4j.Logger;


public class Clazz extends Observable implements Observer {
	
	private static Logger log = Logger.getLogger( Clazz.class );
	private Long id;
	private String name;
	private String description;
	private Clazz parent;
	
	private List<IAttribute> attributes;
	private List<IRelation> relations;
	private List<IManipulation> manipulations;
	private List<IObjekt> objekts;
	
	Clazz( String name, String description, Clazz parent ){
		this.name = name;
		this.description = description;
		this.parent = parent;
	}
	
	Clazz( Long clazzId, String name, String description, Clazz parent ){
		this.name = name;
		this.description = description;
		this.parent = parent;
		this.id = clazzId;
	}
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public Clazz getParentClazz() {
		return parent;
	}
	public void setParentClazz(Clazz parentClazz) {
		this.parent = parentClazz;
	}
	public List<IAttribute> getAttributes() {
		return attributes;
	}
	public void setAttributes(List<IAttribute> attributes) {
		this.attributes = attributes;
	}
	public List<IRelation> getRelations() {
		return relations;
	}
	public void setRelations(List<IRelation> relations) {
		this.relations = relations;
	}
	public List<IManipulation> getManipulations() {
		return manipulations;
	}
	public void setManipulations(List<IManipulation> manipulations) {
		this.manipulations = manipulations;
	}
	public List<IObjekt> getObjekts() {
		return objekts;
	}
	public void setObjekts(List<IObjekt> objekts) {
		this.objekts = objekts;
	}

	public IAttribute addAttribute(IAttribute attribute) {
		// TODO Auto-generated method stub
		return null;
	}

	public IManipulation addManipulation(IManipulation manipulation) {
		// TODO Auto-generated method stub
		return null;
	}

	public void addObjekt(IObjekt objekt) {
		// TODO Auto-generated method stub
		
	}

	public IRelation addRelation(IRelation relation) {
		// TODO Auto-generated method stub
		return null;
	}

	public void removeManipulation(IManipulation manipulation) {
		// TODO Auto-generated method stub
		
	}

	public void removeObjekt(IObjekt objekt) {
		// TODO Auto-generated method stub
		
	}

	public void removeObserver(Observer o) {
		// TODO Auto-generated method stub
		
	}

	public void removeRelation(IRelation relation) {
		// TODO Auto-generated method stub
		
	}

	public void setAttribute(List<IAttribute> attributes) {
		// TODO Auto-generated method stub
		
	}

	public void setManipulation(List<IManipulation> manipulations) {
		// TODO Auto-generated method stub
		
	}

	public void update(Observable o, Object arg) {
		// TODO Auto-generated method stub
		
	}


	public Map<ClazzFields,String> getDataMap(){
		Map<ClazzFields,String> map = new HashMap<ClazzFields,String>();
		
		map.put( ClazzFields.CLAZZ_ID, id.toString() );
		map.put( ClazzFields.CLAZZ_NAME, name );
		map.put( ClazzFields.CLAZZ_DESCRIPTION, description );
		if( parent != null )
			map.put( ClazzFields.CLAZZ_PARENT_ID, parent.getId().toString() );
		
		return map;
	}

}
